home *** CD-ROM | disk | FTP | other *** search
- /*
-
- TrapWeaver Suite header file
-
- Version 1 - Written by Josh Freeman
-
- (c)1998 Twilight Edge Software
-
- Email: software@twilightedge.com
-
- This file may be freely distributed provided it is unchanged.
-
- **********************************************************************
-
- A set of functions to make it easier to set up and manage system patches.
-
- This suite is only for convenience and is not required in order to make use of
- TrapWeaver's patch management functionality, with one exception: If your patch
- needs to call SysSet/GetTrapAddress() from within itself, please see the comments
- accompanying CreatorSet/GetTrapAddress() below.
-
- */
-
- #ifndef _trapweaversuite_h_
- #define _trapweaversuite_h_
-
- #ifndef __PILOT_H__
- #include <Pilot.h>
- #endif
-
- #define kTrapWeaverCreatorID 'TpWv'
- #define kTrapWeaverSuiteFtr 100
-
- /*
-
- TrapWeaverSuite Version 1
-
- SetupPatch() - Copies the procedure at 'procP' to TrapWeaver's runtime database,
- locks it down, calls SysSetTrapAddress() on the DB entry. Needs to know the size
- of the patch, which can be found by disassembling the source file.
- To remove your patch, restore the trap address to the value it held before
- setting the patch up. (Call SysGetTrapAddress() before you patch, save the result,
- and pass it to SysSetTrapAddress() to uninstall the patch) The entry in the runtime
- database will automatically be deleted when a patch is removed.
-
- NewReadOnlyChunk(), OverwriteReadOnlyChunk(), and DeleteReadOnlyChunk() are mirrors of
- Data Manager routines, except they read and write only to the TrapWeaver runtime
- database. These are useful for storing non-patch utility functions that may be
- called by your patches or other apps.
-
- CreatorSetTrapAddress(), CreatorGetTrapAddress() - These functions are necessary ONLY if
- you need to call SysSet/GetTrapAddress() from inside a patch, such as for setting
- up another patch from within your first patch.
- -----------------------------------------------------------------------------------
- IMPORTANT: Any patch which needs to call SysSet/GetTrapAddress() should use these
- functions instead.
- -----------------------------------------------------------------------------------
- This is because TrapWeaver keeps track of whichever app is currently running when
- SysSet/GetTrapAddress() are called - if another app is running and your patch
- attempts to set up a patch, TrapWeaver will mistakenly assume that the other app
- is the one doing the patching. CreatorSet/GetTrapAddress() will take your app's
- creator ID and TrapWeaver will ignore the currently-running app's ID, so that it
- correctly identifies the patch's owner.
-
- */
-
- typedef struct
- {
- ULong TrapWeaverVersion;
- ULong suiteVersion; // value: 1
- Err (*SetupPatch) (UInt trapNum, VoidPtr procP, ULong size);
-
- VoidPtr (*NewReadOnlyChunk) (VoidPtr procP, ULong size);
- Err (*OverwriteReadOnlyChunk) (VoidPtr chunk, ULong offset, VoidPtr newChunk,
- ULong size);
- Err (*DeleteReadOnlyChunk) (VoidPtr chunk);
-
- Err (*CreatorSetTrapAddress) (ULong creatorID, UInt trapNum, VoidPtr procP);
- VoidPtr (*CreatorGetTrapAddress) (ULong creatorID, UInt trapNum);
-
- } TrapWeaverSuite1;
-
-
- #endif // trapweaversuite.h